﻿Imports kplusEntity.KPLUS.Entity
Imports kplusLogic.KPLUS.Logic
Imports System.Globalization
Imports Ultimus.WFServer

Partial Public Class frmPBIAnualMnt
    Inherits System.Web.UI.Page
    Private strConexion As String

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        strConexion = ConfigurationManager.ConnectionStrings("ConnectionStringOracle").ConnectionString
        CargarGvwPBI()
    End Sub
    Public Sub CargarGvwPBI()
        Dim pbi As New EPBI
        Dim objLPBI As New LPBI
        gvwPBI.DataSource = objLPBI.fListarPBI(strConexion)
        gvwPBI.DataBind()
    End Sub

    Public Sub ObtenerPeriodoFlujo()
        Dim strMes As String = CultureInfo.CurrentCulture.DateTimeFormat.MonthNames(Date.Now.Month)
        Dim strAnhio As String = Date.Now.Year
        lblPeriodo.Text = strMes + "," + strAnhio
    End Sub

    Public Sub ObtenerNombreCompletoUsuario()
        Dim strNombreCompleto As String = "NO NAME"
        Dim objLUltimus As New LUltimus
        Dim strUserId As String = Request.Cookies("UserId").Value

        If objLUltimus.fObtenerDatosUser(strUserId, strNombreCompleto) Then
            lblUsuario.Text = strNombreCompleto
        End If
    End Sub

    Protected Sub imbEnviar_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imbEnviar.Click
        Dim strUsuario As String = Request.Cookies("UserId").Value
        Dim strTarea As String = Request.Cookies("TaskId").Value

        Dim objTarea As New Task
        objTarea.InitializeFromTaskId(strTarea)
        Dim intNIncidente As Integer = 0
        Dim sError As String = ""
        objTarea.Send(Nothing, Nothing, Nothing, intNIncidente, sError)

        ScriptManager.RegisterStartupScript(Me, Page.GetType, "Aviso", "window.close();", True)
    End Sub
End Class